<template>
  <div class="layout-page">
    <router-view @hs="active = $event"></router-view>
    <van-tabbar v-model="active">
      <van-tabbar-item to="/article" icon="comment-o">面经</van-tabbar-item>
      <van-tabbar-item to="/collect" icon="star-o">收藏</van-tabbar-item>
      <van-tabbar-item to="/like" icon="like-o">喜欢</van-tabbar-item>
      <van-tabbar-item to="/user" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'LayoutPage',
  data () {
    return {
      active: 0
    }
  },
  methods: {
    doaa () {
      console.log('123')
    }
  },
  created () {
    switch (this.$route.path) {
      case '/article':
        this.active = 0
        break
      case '/collect':
        this.active = 1
        break
      case '/like':
        this.active = 2
        break
      case '/user':
        this.active = 3
        break
    }
  }
}
</script>

<style lang="less" scoped></style>
